package com.derek.omshopping.ui.classify;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import android.widget.TextView;

import com.derek.omshopping.R;
import com.derek.omshopping.bean.classify.ClassifyRightTypeBean;

import java.util.List;

/**
 * Created by My on 2016/10/18.
 */

public class ClassifyRightTypeAdapter extends BaseAdapter {
    private List<ClassifyRightTypeBean> list_right;
    private Context context;
    public ClassifyRightTypeAdapter(List<ClassifyRightTypeBean> list_right, Context context){
        this.context=context;
        this.list_right=list_right;
    }

    @Override
    public int getCount() {
        return list_right.size();
    }

    @Override
    public Object getItem(int position) {
        return list_right.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
       viewHolder holder=null;
        if(convertView==null){
            convertView=LayoutInflater.from(context).inflate(R.layout.fragment_classifyrighttype_item,null);
            holder=new viewHolder();
            holder.shop_nm_3= (TextView) convertView.findViewById(R.id.tv_classify_righttype_item);
            convertView.setTag(holder);
        }else{
            holder= (viewHolder)convertView.getTag();
        }
        holder.shop_nm_3.setText(list_right.get(position).getShop_nm_3());
        return convertView;
    }
    static class viewHolder{
        TextView shop_nm_3;
    }
}
